<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body>
    <!-- 36.三个输入框，输入出生年月日，点击确定 输出出生了多少天 和什么星座 -->
    <input type="number" placeholder="请输入出生年份">
    <input type="number" placeholder="请输入出生月份">
    
    <input type="number" placeholder="请输入出生日"><br><br>
    <button id='btn'>确定</button>
    <h2></h2>
</body>
<script>
//白羊座3.21-4.19  金牛座4.20-5.20  双子座5.21-6.21  巨蟹座6.22-7.22  狮子座7.23-8.22              处女座8.23-9.22  天秤座9.23-10.23  天蝎座10.24-11.22  射手座11.23-12.21                             摩羯座12.22-1.19  水瓶座1.20-2.18       双鱼座2.19-3.20
    
$('#btn').click(function(){
        var year=$('input:eq(0)').val(),
            mouth=$('input:eq(1)').val(),
            day=$('input:eq(2)').val();
        var constellation;   //星座
        if(mouth==3){
            if(day>=21&&day<=31){constellation='白羊座'}
        }
        if(mouth==4){
            if(day>=1&&day<=19){constellation='白羊座'}
            if(day>=20&&day<=30){constellation='金牛座'}
        }
        if(mouth==5){
            if(day>=1&&day<=20){constellation='金牛座'}
            if(day>=21&&day<=31){constellation='双子座'}
        }
        if(mouth==6){
            if(day>=1&&day<=21){constellation='双子座'}
            if(day>=22&&day<=30){constellation='巨蟹座'}
        }
        if(mouth==7){
            if(day>=1&&day<=22){constellation='巨蟹座'}
            if(day>=23&&day<=31){constellation='狮子座'}
        }
        if(mouth==8){
            if(day>=1&&day<=22){constellation='狮子座'}
            if(day>=23&&day<=31){constellation='处女座'}
        }
        if(mouth==9){
            if(day>=1&&day<=22){constellation='处女座'}
            if(day>=23&&day<=30){constellation='天秤座'}
        }
        if(mouth==10){
            if(day>=1&&day<=23){constellation='天秤座'}
            if(day>=24&&day<=31){constellation='天蝎座'}
        }
        if(mouth==11){
            if(day>=1&&day<=22){constellation='天蝎座'}
            if(day>=23&&day<=3){constellation='射手座'}
        }
        if(mouth==12){
            if(day>=1&&day<=21){constellation='射手座'}
            if(day>=22&&day<=19){constellation='摩羯座'}
        }
        if(mouth==1){
            if(day>=1&&day<=19){constellation='摩羯座'}
            if(day>=20&&day<=31){constellation='水瓶座'}
        }
        if(mouth==2){
            if(day>=1&&day<=18){constellation='水瓶座'}
            if(day>=19&&day<=30){constellation='双鱼座'}
        }
        if(mouth==3){
            if(day>=1&&day<=20){constellation='双鱼座'}
        }
    
        var time=year+'-'+mouth+'-'+day;
        var data=new Date(time).getTime();   //生日
        var xian=new Date().getTime(),       //现在时间
            cha=xian-data,
            day=Math.floor(cha/24/60/60/1000);  //天        
        $('h2').html(`您已出生${day}天,星座是${constellation}`)
    })
</script>
</html>